import { Model } from 'dva';
import Service from '@/public/http/services';
export default {
    namespace: 'goodsManagement',
    state: {
        list: [],
        total: 0
    },
    effects: {
        *fetchList({ payload }, { put, call }) {
            const result = yield call(Service.queryListGoodsPage, payload);
            const result2 = yield call(Service.queryGroup, payload);
            yield put({ type: 'setList', payload: {r1:result,r2:result2} });
        },
    },
    reducers: {
        setList(state, { payload: { r1, r2 } }: any) {
            state.list = r1.records;
            state.total = r1.total;
            state.specs = r2
            return state;
        }
    },
} as Model

